-- card: 4010 from stack: in.0 -- bmap block id: 6392 -- flags: 0000 -- background id: 2745 -- name: -- part 1 (field) -- low flags: 01 -- high flags: 0007 -- rect: left=0 top=126 right=312 bottom=364 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: source code listing -- part 3 (button) -- low flags: 00 -- high flags: A002 -- rect: left=0 top=311 right=330 bottom=124 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Copy Source Code -- part contents for background part 3 ----- text ----- For those of you interested here is the source code listing for Alerts Dialogs in HyperCard done in LightSpeed Pascal™. It was compiled and linked with the DAPasLib and MacTraps. Then it was built and saved as a resource of type XCMD and pasted along with the related resources via ResEdit into this stack. -- part contents for card part 1 ----- text ----- {©1988 by Maurice Volaski and portions ©1986,1987 by Think Technologies, Inc.} unit AlertsForHypercard; interface type XCmdPtr = ^XCmdBlock; XCmdBlock = record paramCount : INTEGER; params : array[1..16] of Handle; returnValue : Handle; passFlag : BOOLEAN; entryPoint : ProcPtr; request : INTEGER; result : INTEGER; inArgs : array[1..8] of LongInt; outArgs : array[1..4] of LongInt; end; procedure main (paramPtr : XCmdPtr); implementation procedure Alert (paramPtr : XCmdPtr); forward; procedure main; begin Alert(paramPtr); end; procedure sound (soundnumber : integer); begin soundNumber := 1; Sysbeep(10); end; procedure nothing (soundNumber : integer); begin soundNumber := 0; end; procedure Alert; const xreqPasToZero = 7; xreqZeroToPas = 8; xreqStrToNum = 10; xreqStrToBool = 11; xreqNumToStr = 14; OKAlert = 2594; CancelAlert = 4381; OKCancelAlert = 15163; CancelOKAlert = 16661; type Str31 = string[31]; var alertBox, icon, btnArgmt, NumOfBtns, beep : integer; theText, theString : Str255; procedure DoJsr (addr : ProcPtr); inline $205F, $4E90; procedure ZeroToPas (zeroStr : Ptr; var pasStr : Str255); begin with paramPtr^ do begin inArgs[1] := ORD(zeroStr); inArgs[2] := ORD(@pasStr); request := xreqZeroToPas; DoJsr(entryPoint); end; end; function PasToZero (str : Str255) : Handle; begin with paramPtr^ do begin inArgs[1] := ORD(@str); request := xreqPasToZero; DoJsr(entryPoint); PasToZero := Handle(outArgs[1]); end; end; function StrToNum (str : Str31) : LongInt; begin with paramPtr^ do begin inArgs[1] := ORD(@str); request := xreqStrToNum; DoJsr(entryPoint); StrToNum := outArgs[1]; end; end; function NumToStr (num : LongInt) : Str31; var str : Str31; begin with paramPtr^ do begin inArgs[1] := num; inArgs[2] := ORD(@str); request := xreqNumToStr; DoJsr(entryPoint); NumToStr := str; end; end; function StrToBool (str : Str31) : BOOLEAN; begin with paramPtr^ do begin inArgs[1] := ORD(@str); request := xreqStrToBool; DoJsr(entryPoint); StrToBool := BOOLEAN(outArgs[1]); end; end; procedure OneButton; procedure DoOneBtnAlert (whichdialog : integer); begin {begin DoOneBtnAlert} case icon of 1 : alertBox := NoteAlert(whichdialog, nil); 2 : alertBox := CautionAlert(whichdialog, nil); 3 : alertBox := StopAlert(whichdialog, nil); end; {end case} end; {end DoOneBtnAlert} begin {begin OneButton} if btnArgmt = 1 then DoOneBtnAlert(OKAlert) else DoOneBtnAlert(CancelAlert) end; {end OneButton} procedure TwoButton; procedure DoTwoBtnAlert (whichDialog : integer); procedure PassResult (theAlertItem : integer); var resultString : str31; begin {begin PassResult} if btnArgmt = 3 then if theAlertItem = 1 then begin resultString := NumToStr(1); paramPtr^.returnValue := PasToZero(resultString); end else begin resultString := NumToStr(2); paramPtr^.returnValue := PasToZero(resultString); end else if theAlertItem = 1 then begin resultString := NumToStr(2); paramPtr^.returnValue := PasToZero(resultString); end else begin resultString := NumToStr(1); paramPtr^.returnValue := PasToZero(resultString); end; end; {end PassResult} begin {begin DoTwoBtnAlert} case icon of 1 : alertBox := NoteAlert(whichDialog, nil); 2 : alertBox := CautionAlert(whichDialog, nil); 3 : alertBox := StopAlert(whichDialog, nil); end; {end case} PassResult(alertBox); end; {end DoTwoBtnAlert} begin {begin TwoButton} if btnArgmt = 3 then DoTwoBtnAlert(OKCancelAlert) else DoTwoBtnAlert(CancelOKAlert); end; {end TwoButton} begin {begin Alert} with paramPtr^ do begin ZeroToPas(params[1]^, theString); icon := StrToNum(theString); ZeroToPas(params[2]^, theString); btnArgmt := StrToNum(theString); ZeroToPas(params[3]^, theString); theText := theString; ZeroToPas(params[4]^, theString); beep := StrToNum(theString); end; {end while} ParamText(theText, '', '', ''); if beep = 1 then ErrorSound(@sound) else if beep = 0 then ErrorSound(@nothing); case btnArgmt of 1, 2 : oneButton; 3, 4 : twoButton; end; {end case} end; {end Alert} end. {end unit}